import { SVGUnitParserFactory } from "./svgunitparserfactory";
class SvgGParser {
    constructor(svgHeight) {
        this.graphList = [];
        this.svgHeight = svgHeight;
    }

    parse(mainEle, ignoreSelf) {
        let tagName = mainEle.tagName;
        let result = null;
        if (!ignoreSelf) {
            result = SVGUnitParserFactory.parse(mainEle, false, this.svgHeight);
            if (result) {
                this.graphList.push(result);
            }
        }

        let childEles = mainEle.children;
        for (let i = 0; i < childEles.length; i++) {
            const childEle = childEles[i];
            let tagName = childEle.tagName;
            let result = SVGUnitParserFactory.parse(childEle, false, this.svgHeight);
            if (result) {
                this.graphList.push(result);
                ignoreSelf = true;
            }
            this.parse(childEle,ignoreSelf);
        }
    }
}

export { SvgGParser }